const config = require('./config.json')
module.exports = {
  mode: 'universal',
  /*
   ** Headers of the page
   */
  server: {
    host: config.APP__HOST, // default: localhost
    port: config.APP__PORT // default: 3000
  },
  head: {
    title: config.APP__TITLE || process.env.npm_package_name || '',
    meta: [
      {
        charset: 'utf-8'
      },
      {
        name: 'viewport',
        content: 'width=device-width, initial-scale=1'
      },
      {
        name: 'keywords',
        content: config.APP__KEYWORDS
      },
      {
        hid: 'description',
        name: 'description',
        content:
          config.APP__DESCRIPTION || process.env.npm_package_description || ''
      }
    ],
    link: [
      {
        rel: 'icon',
        type: 'image/x-icon',
        href: '/favicon.ico'
      }
    ]
  },
  /*
   ** Customize the progress-bar color
   */
  loading: {
    color: '#fff'
  },
  /*
   ** config CSS
   */
  // css: ['@/assets/css/reset.css'],
  /*
   ** Plugins to load before mounting the App
   */
  plugins: [
    '@/plugins/element-ui/element-ui',
    {
      src: '@/plugins/vue-mavon-editor',
      srr: false
    },
    {
      src: '@/plugins/axios',
      srr: true
    }
  ],
  /*
   ** Nuxt.js dev-modules
   */
  buildModules: [
    // Doc: https://github.com/nuxt-community/eslint-module
    '@nuxtjs/eslint-module'
  ],
  /*
   ** Nuxt.js modules
   */
  modules: [
    // Doc: https://axios.nuxtjs.org/usage
    '@nuxtjs/axios',
    '@nuxtjs/style-resources'
  ],
  styleResources: {
    scss: './assets/css/base.scss'
  },
  /*
   ** Axios module configuration
   ** See https://axios.nuxtjs.org/options
   */
  axios: {
    baseURL:
      process.env.NODE_ENV === 'production'
        ? `${config.APP__HOST__PRODUCT}:${config.APP__PORT__PRODUCT}/api`
        : `${config.APP__HOST__PROXY}:${config.APP__PORT__PROXY}/api`,
    retry: {
      retries: 3
    },
    // 开发模式下开启debug
    // debug: process.env._ENV !== 'production',
    // 设置不同环境的请求地址
    withCredentials: true,
    timeout: 1000 * 12
  },
  /*
   ** Build configuration
   */
  build: {
    transpile: [/^element-ui/],
    /*
     ** You can extend webpack config here
     */
    extend(config, ctx) {},
    vendor: ['axios']
  },
  render: {
    resourceHints: false
  }
}
